﻿// "Therefore those skilled at the unorthodox
// are infinite as heaven and earth,
// inexhaustible as the great rivers.
// When they come to an end,
// they bagin again,
// like the days and months;
// they die and are reborn,
// like the four seasons."
// 
// - Sun Tsu,
// "The Art of War"

namespace Infrastructure.Logging
{
    public class LogicalThreadContextProperties
    {
        /// <summary>
        /// create proxy for real property collection
        /// </summary>
        /// <param name="props">real property collection</param>
        public LogicalThreadContextProperties( log4net.Util.LogicalThreadContextProperties props )
        {
            mProps = props;
        }

        /// <summary>
        ///             Remove a property
        /// </summary>
        /// <param name="key">the key for the entry to remove</param>
        /// <remarks>
        /// <para>
        ///             Remove the value for the specified <paramref name="key" /> from the context.
        /// </para>
        /// </remarks>
        public void Remove( string key )
        {
            mProps.Remove( key );
        }

        /// <summary>
        ///             Clear all the context properties
        /// </summary>
        /// <remarks>
        /// <para>
        ///             Clear all the context properties
        /// </para>
        /// </remarks>
        public void Clear()
        {
            mProps.Clear();
        }

        /// <summary>
        ///             Gets or sets the value of a property
        /// </summary>
        /// <value>
        ///             The value for the property with the specified key
        /// </value>
        /// <remarks>
        /// <para>
        ///             Get or set the property value for the <paramref name="key" /> specified.
        /// </para>
        /// </remarks>
        public object this[ string key ]
        {
            get { return mProps[key]; }
            set { mProps[key] = value; }
        }

        /// <summary>
        /// real property collection
        /// </summary>
        private readonly log4net.Util.LogicalThreadContextProperties mProps;
    }
}
